/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import OBJECT.LoaiNhanVien;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

/**
 *
 * @author TAN
 */
public class LoaiNhanVienDAO {
    private Connect connect=null;
   public LoaiNhanVienDAO(String User ,String Pass,String port,String DataBase,String Host) {
        connect =new Connect( User , Pass, port, DataBase, Host);
    }
      public ArrayList<LoaiNhanVien> DanhSachLoaiNhanVien()
    {
        ArrayList<LoaiNhanVien> ds=new ArrayList<LoaiNhanVien>();
        
        Connection conn=connect.GetConnect();
        ResultSet result=null;
        try {
            CallableStatement cals=conn.prepareCall("{call sp_ThongTinLoaiNhanVien()}");
            result =cals.executeQuery();
            System.out.println("asdasjdh");
           while(result.next())
           {
               LoaiNhanVien lnv=new LoaiNhanVien();
               lnv.setLoaiNhanVien(result.getInt("Loai_NV"));
               lnv.setTenLoai(result.getString("TenLoai_NV"));
               ds.add(lnv);
           }
              
        } catch (SQLException ex) {
          ;
            
        }
       
        return  ds;
    } 
         public void CloseConnect()
      {
          try
          {
          connect.Close();
          }catch(Exception e)
          {
              ;
          }
      } 
}
